/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.chl.niclun.projectwebshop.nbp;



import edu.chl.niclun.projectwebshop.nbp.DataBase.Database;
import edu.chl.niclun.projectwebshop.nbp.Entities.Movie;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import javax.faces.event.ActionEvent;


/**
 *Controllerbean for the leftmenu
 * @author Daniel
 */


@ManagedBean
@RequestScoped
public class LeftMenuControllerBean {
    @ManagedProperty(value = "#{showResultBackingBean}")
    ShowResultBackingBean showResultBackingBean;
    
    /** Creates a new instance of LeftMenuControllerBean */
    public LeftMenuControllerBean() {
    }
    
    //navigate to show result
    public String navigate(){
        return "showResult";
    }
    
    //used when we press any of the genres in the left menu
    public void search(ActionEvent evt, String command){
        
        List<Movie> list = Database.getWebshopController().searchGenre(command);

        showResultBackingBean.setMovies(list);
            
    }

    public ShowResultBackingBean getShowResultBackingBean() {
        return showResultBackingBean;
    }

    public void setShowResultBackingBean(ShowResultBackingBean showResultBackingBean) {
        this.showResultBackingBean = showResultBackingBean;
    }

    
}
